<!DOCTYPE html>
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>订单管理-车速递</title>
    <link rel="stylesheet" href="../css/bootstrap.min.css">
    <link rel="stylesheet" href="../layui/css/layui.css"  media="all">
    <link rel="stylesheet" href="../css/mymain.mymain.css">
    <script type="application/javascript" src="../js/jquery-3.3.1.js"></script>
    <script type="application/javascript" src="../js/bootstrap.min.js"></script>
    <script type="application/javascript" src="../layui/layui.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>

</head>
<body style="position: static">

<div id="app" class="bgGray">
    <div data-v-95ac8d30="" class="header3">
        <div data-v-95ac8d30="" class="layout clear">
            <div data-v-95ac8d30="" class="left logo">
                <a data-v-95ac8d30="" href="index.html">
                    <img data-v-95ac8d30="" src="">
                </a>
            </div> <div data-v-95ac8d30="" class="header3Nav right">|<a data-v-95ac8d30="" href="orderManage.html">我的订单</a>|<a data-v-95ac8d30="" href="helpCenter.html">帮助中心</a>|<a data-v-95ac8d30="" href="javascript:void">退出</a>
        </div>
            <div data-v-95ac8d30="" class="header3User right">
                <i data-v-95ac8d30="" class="iconfont icon-phone"></i>
            <span data-v-95ac8d30="" class="sp1">400-919-8000</span>
            <span data-v-95ac8d30="" class="sp2">欢迎您，</span>
            <span data-v-95ac8d30="" class="sp3"></span>
        </div>
        </div>
    </div>
    <div class="userInfo">
        <div class="layout">
            <div class="userInfoCom clear">
                <div class="userInfoL left">
                    <div data-v-1cae2c34="" class="userNav">
                        <dl data-v-1cae2c34="" class="userMsg">
                            <dt data-v-1cae2c34="">
                                <img data-v-1cae2c34="" src="">
                            </dt>
                            <dd data-v-1cae2c34="">
                                <p data-v-1cae2c34=""></p>
                                <p data-v-1cae2c34="" class="p5 pp" style="">普卡会员</p>
                            </dd>
                        </dl>
                        <ul data-v-1cae2c34="" class="manNav">
                            <li data-v-1cae2c34="">
                                <a data-v-1cae2c34="" href="orderManage.html" class="sel">订单管理</a>
                            </li>
                             <li data-v-1cae2c34="">
                                 <a data-v-1cae2c34="" href="myinfo.html" class="">个人信息</a>
                             </li>
                        </ul>
                    </div>
                </div>
                <div class="userInfoR right">

                    <div class="orderManage manage">
                        <div class="orderManageTit manageTit clear">
                            <div class="left tit">订单管理</div>
                            </div>
                        <div class="orderType clear type">
                            <div class="sel">全部订单</div>
                        </div>
                        <div class="orderList list">
                            <div class="orderListCom listCom" style="position: static;">
                                <table cellspacing="0" cellpadding="0">
                                    <tr class="firstTr">
                                        <th>订单号</th>
                                        <th>订单金额</th>
                                        <th>车型</th>
                                        <th>取车地址</th>
                                        <th>还车地址</th>
                                        <th>订单状态</th>
                                        <th>操作</th>
                                    </tr>
                                </table>
                                <div class="noData" id="noda">

                                    <table cellspacing="0" cellpadding="0">
                                        <tr class="firstTr" v-for="site in obj">
                                            <td>{{site.oid}}</td>
                                            <td>{{site.oprice}}</td>
                                            <td>{{site.cname}}</td>
                                            <td>{{site.getcity}}</td>
                                            <td>{{site.backcity}}</td>
                                            <td>{{site.ostatus}}</td>
                                            <td><a href="#" @click="del2(site.oid)" style="color:red" id="delid">删除</a></td>
                                        </tr>
                                    </table>


                                    <div id="fenye"></div>

                                </div>

                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div data-v-3aaf9db2="" class="footer2">
        <div data-v-3aaf9db2="" class="layout clear">
            <div data-v-3aaf9db2="" class="d1">
                <a data-v-3aaf9db2="" href="about.html">关于车速递</a></div></div></div>

   </div>

<script type="text/javascript">
    var totalCount;

    var vm = new Vue({
        el:'#noda',
        data:{
            obj:[],

        },
        methods:{
            del2:function (id) {
                if (confirm("确定删除吗?")){
                    $.ajax({
                        type:"post",
                        url:"/order2/del2",
                        data:JSON.stringify({"id":id}),
                        contentType:"application/json",
                        dataType:"json",
                        success:function (data) {
                            alert("删除成功！");
                            window.location.reload();
                        }
                    })
                }
            }
        }
    });

    $(function () {
        loadData(1);
    })
    function loadData(page) {
        $.ajax({
            type:"get",
            url:"/order2/all?page="+page+"&limit=5",
            dataType:'json',
            async: false,
            success:function(data){
                //id为0时为父类
                if(data.code==1){
                    totalCount = data.info.total;
                    vm.obj=data.info.list;
                } else{
                    alert(data.info);
                }
            },
            error:function () {
                alert("ajax加载错误");
            }
        })
    }


    layui.use(['laypage', 'layer'], function() {
        var laypage = layui.laypage
            , layer = layui.layer;

        //总页数大于页码总数
        laypage.render({
            elem: 'fenye'
            , count: totalCount //数据总数
            , limit:5
            , jump: function (obj, first) {
                /*console.log(obj)*/
                var currentPage = obj.curr;

                loadData(currentPage);

            }
        });

    });


</script>

</body>
</html>